package com.fhz.shop.ui.cart;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModel;

import com.fhz.shop.callback.ApiResponse;
import com.fhz.shop.entity.UserCart;

import java.util.List;

import javax.inject.Inject;

import dagger.hilt.android.lifecycle.HiltViewModel;


@HiltViewModel
public class CartViewModel extends ViewModel {
    @Inject
    CartRepository mCartRepository;

    @Inject
    public CartViewModel() {
    }

    public LiveData<ApiResponse<List<UserCart>>> getCartList(int userId){
        return mCartRepository.getCartList(userId);
    }

    public LiveData<ApiResponse<UserCart>> updateNum(int cartId ,int num){
        return mCartRepository.updateNum(cartId, num);
    }

}